/* 信息弹窗关闭按钮美化及hover效果 */
.node-details-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: rgba(0,0,0,0.10);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    transition: background 0.18s;
    z-index: 10;
    outline: none;
}
.node-details-close-btn:hover {
    background: rgba(66,133,244,0.18);
}
.node-details-close-icon {
    display: block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    font-size: 22px;
    color: #666;
    user-select: none;
    transition: color 0.18s;
}
.node-details-close-btn:hover .node-details-close-icon {
    color: #174ea6;
}
body {
    margin: 0;
    overflow: hidden;
    font-family: Arial, sans-serif;
}
#network {
    width: 100vw;
    height: 100vh;
    background: #f5f5f5;
}
.node {
    fill: #4285f4;
    stroke: #2a56c6;
    stroke-width: 2px;
    cursor: move;
    transition: all 0.3s ease;
}
.node:hover {
    fill: #34a853;
    transform: scale(1.1);
}
.node text {
    pointer-events: none;
    font-size: 12px;
    fill: white;
    text-anchor: middle;
    dominant-baseline: central;
}
.link {
    stroke: #999;
    stroke-opacity: 0.6;
    stroke-width: 2px;
    stroke-linecap: round;
}
.link:hover {
    stroke: #555;
    stroke-opacity: 1;
}
.node.highlight circle {
    fill: #ff5722 !important;
    stroke: #e64a19 !important;
    stroke-width: 3px !important;
    transform: scale(1.2);
    transition: all 0.3s ease;
    filter: drop-shadow(0 0 5px rgba(255,87,34,0.7));
}
.help-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 20px;
    border-radius: 10px;
    max-width: 500px;
    display: none;
    z-index: 100;
}
.search-box {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255,255,255,0.9);
    padding: 15px;
    display: none;
    z-index: 50;
}
.search-box input {
    width: 100%;
    padding: 10px;
    font-size: 20px;
    border: 2px solid #4285f4;
    border-radius: 5px;
}

/* 表单容器样式 */
.node-form-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    min-width: 40px; /* 最小宽度容纳按钮 */
    min-height: 40px;
}

/* 表单切换按钮 - 收起状态 */
.form-toggle-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    background: #4285f4;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

/* 表单切换按钮 - 展开状态 */
.node-form-container.expanded .form-toggle-btn {
    bottom: auto;
    right: auto;
    top: 0;
    left: 0;
}

.form-toggle-btn:hover {
    transform: scale(1.1);
}

/* 主表单容器 */
.node-form {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    padding: 15px;
    max-width: 350px;
    margin-top: 50px; /* 为切换按钮留出空间 */
    display: none;
}

.node-form-container.expanded .node-form {
    display: block;
}

/* 选项卡样式 */
.form-tabs {
    display: flex;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.form-tab {
    padding: 8px 15px;
    cursor: pointer;
    margin-right: 5px;
    border-bottom: 2px solid transparent;
    font-weight: normal;
    color: #666;
}

.form-tab.active {
    border-bottom-color: #4285f4;
    font-weight: bold;
    color: #000;
}

.form-tab:hover {
    border-bottom-color: #4285f4;
}

/* 表单内容区域 */
.form-content {
    display: none;
}

.form-content.active {
    display: block;
}

/* 表单元素样式 */
.node-form-content form,
.add-connection-form-content form,
.remove-node-form-content form,
.remove-connection-form-content form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.node-form-content label,
.add-connection-form-content label,
.remove-node-form-content label,
.remove-connection-form-content label {
    font-weight: bold;
    color: #555;
}

.node-form-content input,
.node-form-content textarea,
.add-connection-form-content input,
.remove-node-form-content input,
.remove-connection-form-content input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
}

.node-form-content button,
.add-connection-form-content button,
.remove-node-form-content button,
.remove-connection-form-content button {
    background: #4285f4;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
}

/* 搜索结果容器 */
.connection-results,
.add-connection-results,
.remove-connection-results {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 5px;
}

/* 拾取节点图标 */
.pick-node-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: white;
    border: 2px solid #4285f4;
    color: #4285f4;
    font-size: 18px;
    font-weight: bold;
    border-radius: 12px; /* 使用精确半径确保完美圆形 */
    margin-right: 8px;
    box-sizing: border-box; /* 确保边框包含在尺寸内 */
    cursor: pointer;
    transition: all 0.2s ease;
}

.pick-node-icon:hover {
    background: #4285f4;
    color: white;
    transform: scale(1.1);
}

.pick-node-icon.dragging {
    background: #34a853;
    border-color: #34a853;
    color: white;
}

/* 节点信息弹窗美化 */
.node-details-popup {
    background: rgba(255,255,255,0.92);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(66,133,244,0.18), 0 1.5px 8px rgba(0,0,0,0.10);
    padding: 18px 20px 14px 20px;
    min-width: 260px;
    max-width: 320px;
    min-height: 120px;
    max-height: 340px;
    overflow-y: auto;
    /* 兼容所有浏览器拖拽滚动条 */
    scrollbar-width: auto;
    scrollbar-color: #4285f4 #e0e7ef;
    /* 保证滚动条可拖动 */
    pointer-events: auto;
    opacity: 0.98;
    border: 1.5px solid #4285f4;
    box-sizing: border-box;
    /* 兼容滚动时下边框可见 */
    border-bottom: 1.5px solid #4285f4;
    z-index: 1000;
}
.node-details-container {
    font-size: 15px;
    color: #222;
    word-break: break-all;
    line-height: 1.7;
}
.node-details-title {
    font-size: 18px;
    font-weight: bold;
    margin: 0 0 8px 0;
    color: #4285f4;
}
.node-details-row {
    margin: 0 0 6px 0;
    white-space: pre-line;
}
.node-connections-list {
    margin-top: 8px;
    max-height: 70px;
    overflow-y: auto;
}
.node-details-curve {
    pointer-events: none;
}